package org.tgcloud.group.web.controller.app;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.*;
import org.tgcloud.group.core.APPResultMessage;
import org.tgcloud.group.core.session.Session;
import org.tgcloud.group.service.manager.project.ProjectIntendedMediaManageService;
import org.tgcloud.group.web.controller.dto.meidaParty.MediaPartyDTO;
import org.tgcloud.group.web.controller.dto.project.IntendedMedia.AppIntendedMediaProjectDTO;
import org.tgcloud.group.web.controller.req.project.intendedMedia.AppIntendedMediaAcceptReq;
import org.tgcloud.group.web.controller.req.project.intendedMedia.AppIntendedMediaExportReq;
import org.tgcloud.group.web.controller.req.project.intendedMedia.AppIntendedMediaRejectReq;
import org.tgcloud.group.web.controller.req.project.intendedMedia.AppIntendedMediaSearchReq;

import java.util.List;

/**
 * @Author: zhy
 * @Created: 2025-08-27-下午2:35
 * @Description:
 */
@Api(tags = "报备媒体相关接口")
@RestController
@RequestMapping("/app/user")
@EnableAutoConfiguration
public class ProjectIntendedMediaController extends ClientAPPBaseController{

    @Autowired
    private ProjectIntendedMediaManageService projectIntendedMediaManageService;

    @ApiOperation(value = "报备媒体列表")
    @ApiImplicitParams({
    })
    @ResponseBody
    @PostMapping(value = "/getIntendedMediaList")
    public APPResultMessage<Object, AppIntendedMediaProjectDTO> getIntendedMediaList(@ModelAttribute("session") Session session,
                                                                                     @RequestBody AppIntendedMediaSearchReq req) {
        return projectIntendedMediaManageService.getIntendedMediaList(session.getUserId(), session.getUserType(),req.getPageNum(), req.getPageSize(), req.getStatus(), req.getKeyword(), req.getMediaPartyId());
    }



    @ApiOperation(value = "报备媒体-驳回")
    @ApiImplicitParams({
    })
    @ResponseBody
    @PostMapping(value = "/doRejectIntendedMedia")
    public APPResultMessage doRejectIntendedMedia(@ModelAttribute("session") Session session,
                                                  @RequestBody AppIntendedMediaRejectReq req) {
        return projectIntendedMediaManageService.doRejectIntendedMedia(session.getUserId(), req.getId(), req.getAuditReason());
    }



    @ApiOperation(value = "报备媒体-通过")
    @ApiImplicitParams({
    })
    @ResponseBody
    @PostMapping(value = "/doAcceptIntendedMedia")
    public APPResultMessage doAcceptIntendedMedia(@ModelAttribute("session") Session session,
                                                  @RequestBody AppIntendedMediaAcceptReq req) {
        return projectIntendedMediaManageService.doAcceptIntendedMedia(session.getUserId(), req.getIds());
    }



    @ApiOperation(value = "媒体方列表")
    @ApiImplicitParams({
    })
    @ResponseBody
    @PostMapping(value = "/getChooseMediumPartyList")
    public APPResultMessage<Object, MediaPartyDTO> getChooseMediumPartyList(@ModelAttribute("session") Session session) {
        return projectIntendedMediaManageService.getChooseMediumPartyList(session.getUserId(), session.getUserType());
    }



    @ApiOperation(value = "媒体方导出")
    @ApiImplicitParams({
    })
    @ResponseBody
    @PostMapping(value = "/doExportMediumParty")
    public APPResultMessage<Object, MediaPartyDTO> doExportMediumParty(@ModelAttribute("session") Session session,
                                                                       @RequestBody AppIntendedMediaExportReq req) {
        return projectIntendedMediaManageService.doExportMediumParty(session.getUserId(), session.getUserType(), req);
    }

}
